import Vue from "vue";
import VueRouter from "vue-router";

import Home from '../views/home'
import Member from '../views/member'
import Supplier from '../views/supplier'
import Goods from '../views/goods'
import Stff from '../views/staff'
import Layout from '../components/Layout'



Vue.use(VueRouter);

const routes = [

  {
    path: "/login",
    name: "login",
    component: () =>
      import(/* webpackChunkName: "about" */ "../views/login"),
  },
  {
    path: "/",
    name: "Layout",
    component:Layout,
    redirect:'/home',
    children:[
       {
         path:'/home',
         component:Home,
         meta:{title:'首页'}
       }
    ]  
},
{
  //会员管理
  path: '/member',
  component: Layout,
  children:[
    {
      path: '/',
      component :Member,
      meta:{title:'会员管理'}
    }
  ]
},
{
  //供应商管理
  path: '/supplier',
  component: Layout,
  children:[
    {
      path: '/',
      component :Supplier,
      meta:{title:'供应商管理'}
    }
  ]
},
{
  //商品管理
  path: '/goods',
  component: Layout,
  children:[
    {
      path: '/',
      component :Goods,
      meta:{title:'商品管理'}
    }
  ]
},
{
  //员工管理
  path: '/staff',
  component: Layout,
  children:[
    {
      path: '/',
      component :Stff,
      meta:{title:'员工管理'}
    }
  ]
}
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});

export default router;
